package com.ruoyi.web.controller.fire;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.fire.domain.TUnit;
import com.ruoyi.fire.domain.dto.TUserUnitVO;
import com.ruoyi.fire.service.ITUserUnitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "TUserUnitController", tags = "用户单位信息")
@RestController
@RequiredArgsConstructor
@RequestMapping("/auth/userUnit")
public class TUserUnitController {

    private final ITUserUnitService tUserUnitService;

    @ApiOperation("授权用户单位信息")
    @Log(title = "授权用户单位信息", businessType = BusinessType.INSERT)
    @PostMapping("authUserUnit")
    public AjaxResult authUserUnit(@RequestBody TUserUnitVO tUserUnitVO) {
        return AjaxResult.success(tUserUnitService.authUserUnit(tUserUnitVO));
    }

    @ApiOperation("用户单位信息")
    @PostMapping("authUserUnitDetail")
    public AjaxResult authUserUnitDetail(@RequestBody TUserUnitVO tUserUnitVO) {
        return AjaxResult.success(tUserUnitService.authUserUnitDetail(tUserUnitVO));
    }

}
